var layer;
var form;
var table;
layui.use(['layer', 'form', 'table'], function () {
    layer = layui.layer;
    form = layui.form;
    table = layui.table;
    upload = layui.upload;
    
   
});

// 初始化图表标签
//var myChart = echarts.init(document.getElementById('attendChart'));

function getEcharts(titleData, value) {
    var options = {
        title: {
            text: "近七日来访",
            textStyle: {
                align: 'center',
                color: '#5fdce8',
                fontSize: 20,
            },
            top: '2%',
            left: 'center',
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: "none"
            }
        },
        toolbox: {
            right: '20',
            show: true,
            itemSize: 15,
            feature: {
                mark: {show: true},
                dataView: {show: true, readOnly: false},
                magicType: {show: true, type: ['line', 'bar']},
                restore: {show: true},
                saveAsImage: {show: true}
            }
        },
        calculable: true,
        //X轴设置
        grid: {
            top: '10%',
            left: '2%',
            right: '2%',
            bottom: '10%',
            containLabel: true
        },
        xAxis: [{
            type: 'category',
            data: titleData,
            axisLabel: {
                show: true,
                textStyle: {
                    color: "#6b858e"//底部字体
                },
            },
            axisLine: {
                lineStyle: {
                    color: "#a3b2b7"
                }
            }
        }],
        yAxis: [{
            type: 'value',
            splitNumber: 4,
            splitLine: {
                lineStyle: {
                    type: 'dashed',
                    color: '#DDD'
                }
            },
            axisLine: {
                show: false,
                lineStyle: {
                    color: "#86979c"
                },
            },
            nameTextStyle: {
                color: "#999"
            },
            splitArea: {
                show: false
            }
        }],
        series: [{
            name: '     来访人数',
            type: 'line',
            data: value,
            lineStyle: {
                normal: {
                    width: 8,
                    color: {
                        type: 'linear',
                        colorStops: [{
                            offset: 0,
                            color: '#87daf3' // 0% 处的颜色
                        }, {
                            offset: 1,
                            color: '#48D8BF' // 100% 处的颜色
                        }],
                        globalCoord: false // 缺省为 false
                    },
                }
            },
            itemStyle: {
                normal: {
                    color: '#fff',
                    borderWidth: 10,
                    borderColor: "#A9F387"
                }
            },
            smooth: true
        }],
        smooth: true
    };
    myChart.setOption(options);
}

//浏览器变动时跟随
window.onresize = function () {
    //myChart.resize();
}









